<script type="text/javascript">
 $(document).ready(function(){
	 $('#Profile_birthday').datepick(({
		 	dateFormat: 'dd/mm/yyyy',
		 	minDate: '01/26/2007',
		 	maxDate: '01/26/2009',
		 	showTrigger: '#calImg'
	}));
 });
</script>

<?php
$this->pageTitle = 'Cập nhật tài khoản [ ' . $model->username. ' ]';
$this->breadcrumbs = array(
	'Tài khoản' => array('profile'),
	'Cập nhật tài khoản',
);
?>
<div class="heading">
    <h1><img src="<?php echo Util::themeUrl() ?>/images/header.ico" /><?php echo $this->pageTitle?></h1>

    <div class="controls">
        <?php
        if(!isset($_GET['ajax']))
            echo CHtml::link("Trở lại trang trước", array('profile'),  array('class' => 'controls'));
        ?>
    </div>
</div>

<div class="content">
	<div class="form">

	<?php $form=$this->beginWidget('ActiveFormBase', array(
		'id'=>'supermod-form',
	//	'enableAjaxValidation'=>true,
		//'disableAjaxValidationAttributes'=>array('SuperMod_verifyPassword'),
		'clientOptions'=>array(
			'validateOnSubmit'=>true,
		),
		'htmlOptions' => array('enctype'=>'multipart/form-data'),
	));
	?><?php echo $form->errorSummary($model); ?>
		<table class="button-form"><tr>
				<td><span class="note"><?php echo UserModule::t('Thông tin bắt buộc <span class="required">*</span>.'); ?></span></td>
				<td align="right">
					<div class="row buttons"><?php echo CHtml::submitButton($model->isNewRecord ? UserModule::t('Create') : UserModule::t('Save')); ?></div>
				</td>
		</tr></table>
		<!--<div class="row">
			<?php //echo $form->labelEx($model,'username'); ?>
			<?php //echo $form->textField($model,'username',array('size'=>20,'maxlength'=>20)); ?>
			<?php //echo $form->error($model,'username'); ?>
		</div>
		--><?php
			$profileFields=$profile->getFields();
			if ($profileFields) {
				foreach($profileFields as $field) {
				?>
		<div class="row">
			<?php echo $form->labelEx($profile,$field->varname); ?>
			<?php
			if ($widgetEdit = $field->widgetEdit($profile)) {
				echo $widgetEdit;
			} elseif ($field->range) {
				echo $form->dropDownList($profile,$field->varname,Profile::range($field->range));
			} elseif ($field->field_type=="TEXT") {
				echo CHtml::activeTextArea($profile,$field->varname,array('rows'=>6, 'cols'=>50));
			} else {
				echo $form->textField($profile,$field->varname,array('size'=>60,'maxlength'=>(($field->field_size)?$field->field_size:255)));
			}
			 ?>
			<?php echo $form->error($profile,$field->varname); ?>
		</div>
				<?php
				}
			}
		?>
		<div class="row">
			<?php echo $form->labelEx($model,'email'); ?>
			<?php echo $form->textField($model,'email',array('size'=>60,'maxlength'=>128)); ?>
			<?php echo $form->error($model,'email'); ?>
		</div>
		<table class="button-form"><tr>
				<td align="right">
					<div class="row buttons"><?php echo CHtml::submitButton($model->isNewRecord ? UserModule::t('Create') : UserModule::t('Save')); ?></div>
				</td>
		</tr></table>

	<?php $this->endWidget(); ?>

	</div><!-- form -->
</div>